
if [ `whoami` != "root" ]
then
	echo "You must be root"
	exit
fi

if [ "$1" = "start" ]
then

	umount -l root/proc 2>/dev/null > /dev/null
	umount -l root/dev 2>/dev/null > /dev/null
	umount -l root/dev/pts 2>/dev/null > /dev/null
	umount -l root/sys 2>/dev/null > /dev/null
	umount -l root/tmp 2>/dev/null > /dev/null
	umount -l root/lib/modules 2>/dev/null > /dev/null


	mount -o bind /proc root/proc 2>/dev/null > /dev/null
	mount -o bind /dev root/dev 2>/dev/null > /dev/null
	mount -o bind /lib/modules root/lib/modules 2>/dev/null >/dev/null
	mount -o bind /dev/pts root/dev/pts 2>/dev/null > /dev/null
	mount -o bind /sys root/sys 2>/dev/null > /dev/null

	/usr/sbin/chroot root/ /bin/start
fi


if [ "$1" = "stop" ]
then
	/usr/sbin/chroot root/ /bin/stop
	umount -l root/proc 2>/dev/null > /dev/null
	umount -l root/dev 2>/dev/null > /dev/null
	umount -l root/lib/modules 2>/dev/null > /dev/null
	umount -l root/dev/pts 2>/dev/null > /dev/null
	umount -l root/sys 2>/dev/null > /dev/null
	umount -l root/tmp 2>/dev/null > /dev/null
fi



if [ "$1" = "connect" ]
then
	/usr/sbin/chroot root/ /bin/sh
fi

if [ "$1" = "mount" ]
then
	mount -o bind /proc root/proc 2>/dev/null > /dev/null
	mount -o bind /dev root/dev 2>/dev/null > /dev/null
	mount -o bind /dev/pts root/dev/pts 2>/dev/null > /dev/null
	mount -o bind /sys root/sys 2>/dev/null > /dev/null
	/usr/sbin/chroot root/ /bin/sh
fi




